#include <iostream>
#include <algorithm>
#include <fstream>
#include <limits>

using namespace std;

#define STDIN
#define STR(s) #s
#define SIZE 101

int N;
int matrix[SIZE][SIZE];

int MaxSubArray(int a[], int l) {
	int m = numeric_limits<int>::min();
	int c = numeric_limits<int>::min();
	for (int i = l-1; i  >= 0; i--) {
		if (c > 0) c += a[i];
		else c = a[i];
		if (c > m) m = c;
	}
	return m;
}

int MaxSubMatrix(int a[][SIZE], int row, int col) {
	int* tc = new int[col];
	int m = matrix[0][0];
	for (int i = 0; i < row; ++i) {
		for (int c = 0; c < col; ++c) {
			tc[c] = 0;
		}
		for (int j = i; j < row; ++j) {
			for (int c = 0; c < col; ++c) {
				tc[c] += matrix[j][c];
			}
			int tmp = MaxSubArray(tc, col);
			m = max<int>(m, tmp);
		}
	}
	delete[] tc;
	return m;
}


int main()
{
#ifdef STDIN
	fstream cin("bin/1050.in");
#endif
	cin >> N;

	int i, j;
	for (i = 0; i < N; ++i)
	{
		for (j = 0; j < N; ++j)
			cin >> matrix[i][j];
	}

	cout << MaxSubMatrix(matrix, N, N) << endl;;

	return 0;

}
